package com.study.studyInstance;
public class TestConstructor {
    public static void main(String[] args) {
        Fish f = new Fish("shark");
//        Fish f = new Fish();
        System.out.println(f.name);//name的默认值为null

    }
}
class Fish{
    String name;
    int age;
    double weight;
    double height;
    //无参构造器
    public Fish(){

    }
    public Fish(String name){
        this.name = name;
    }
    public Fish(int age){
        this.age = age;
    }
    public Fish(double weight,double height){
        this.weight = weight;
        this.height = height;
    }
}